﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entities;

namespace Stationery
{
    public partial class Admin : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Quản trị
            string strUC     = string.Empty;
            string strID     = string.Empty;

            if (Request.Params["id"] != null)
            {
                strID = Request.Params["id"].ToString();
            }

            switch (strID)
            {
                case "product":
                    strUC = "UC/UC_ProductList_Update.ascx";
                    LabelTitle.Text = Utils.label_product_list;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_Product_Update.ascx";
                        LabelTitle.Text = Utils.label_product_update;
                    }
                    break;

                case "category":
                    strUC = "UC/UC_CategoryList_Update.ascx";
                    LabelTitle.Text = Utils.label_category_list;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_Category_Update.ascx";
                        LabelTitle.Text = Utils.label_category_update;
                    }
                    break;

                case "category_parent":
                    strUC = "UC/UC_CategoryList_Update_Parent.ascx";
                    LabelTitle.Text = Utils.label_category_parent_list;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_Category_Update_Parent.ascx";
                        LabelTitle.Text = Utils.label_category_parent_update;
                    }
                    break;

                case "advertise":
                    strUC = "UC/UC_AdvertiseList_Update.ascx";
                    LabelTitle.Text = Utils.label_advertise_list;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_Advertise_Update.ascx";
                        LabelTitle.Text = Utils.label_advertise_update;
                    }
                    break;

                case "handscript":
                    strUC = "UC/UC_Handscript.ascx";
                    LabelTitle.Text = Utils.label_handscript_list;
                    break;

                case "user":
                    strUC = "UC/UC_UserList_Update.ascx";
                    LabelTitle.Text = Utils.label_user_list;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_User_Update.ascx";
                        LabelTitle.Text = Utils.label_user_update;
                    }
                    break;

                case "changepass":
                    strUC = "UC/UC_ChangePass.ascx";
                    LabelTitle.Text = Utils.label_changepass;
                    break;

                case "logout":
                    Session.RemoveAll();
                    Response.Redirect(UtilsURL.home);
                    break;

                case "uploadprice":
                    strUC = "UC/UC_UploadPriceReport_Update.ascx";
                    LabelTitle.Text = Utils.label_price_report;
                    break;

                case "neworder":
                    strUC = "UC/UC_ReportBasket.ascx";
                    LabelTitle.Text = Utils.label_reportbasket_neworder;
                    break;
                case "successfulorder":
                    strUC = "UC/UC_ReportBasket.ascx";
                    LabelTitle.Text = Utils.label_reportbasket_successfulorder;
                    break;

                case "cancelorder":
                    strUC = "UC/UC_ReportBasket.ascx";
                    LabelTitle.Text = Utils.label_reportbasket_cancelorder;
                    break;

                case "orderdetail":
                    strUC = "UC/UC_ReportBasket_Detail.ascx";
                    LabelTitle.Text = Utils.label_reportbasket_detail;
                    break;

                case "banner":
                    strUC = "UC/UC_Banner.ascx";
                    LabelTitle.Text = Utils.label_banner_update;
                    break;

                case "customer":
                    strUC = "UC/UC_CustomerList_Update.ascx";
                    LabelTitle.Text = Utils.label_customer_update;
                    break;

                case "mailbox":
                    strUC = "UC/UC_MailBox_Update.ascx";
                    LabelTitle.Text = Utils.label_mailbox_update;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_MailBox_View.ascx";
                        LabelTitle.Text = Utils.label_mailbox_detail;
                    }
                    break;

                case "groupnews":
                    strUC = "UC/UC_NewsGroup.ascx";
                    LabelTitle.Text = Utils.label_newsgroup;
                    break;

                case "news":
                    strUC = "UC/UC_NewsList.ascx";
                    LabelTitle.Text = Utils.label_news_list;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_NewsAddUpdate.ascx";
                        LabelTitle.Text = Utils.label_news_update;
                    }
                    break;

                case "faq":
                    strUC = "UC/UC_FaqsList.ascx";
                    LabelTitle.Text = Utils.label_faqs_list;
                    if (Request.Params["status"] != null)
                    {
                        strUC = "UC/UC_FaqAddUpdate.ascx";
                        LabelTitle.Text = Utils.label_faqs_update;
                    }
                    break;

                #region ***Quản trị chế biến ngon***
                //case "cook":
                //    strUC = "UC/UC_CookList.ascx";
                //    LabelTitle.Text = Utils.label_cook_list;
                //    if (Request.Params["status"] != null)
                //    {
                //        strUC = "UC/UC_CookAddUpdate.ascx";
                //        LabelTitle.Text = Utils.label_cook_update;
                //    }
                //    break;
                #endregion

                default:
                    strUC = "UC/UC_ProductList_Update.ascx";
                    LabelTitle.Text = Utils.label_product_list;
                    break;
            }

            ucControl.Controls.Add(Page.LoadControl(strUC));
        }
    }
}
